/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jjsoft.disco.gco.view;

import com.jjsoft.disco.gco.dao.GenericController;
import com.jjsoft.disco.gco.mdl.Cliente;
import com.jjsoft.disco.gco.mdl.Factura;
import com.jjsoft.disco.gco.mdl.Ingreso;
import com.jjsoft.disco.gco.ngc.ClienteManager;
import com.jjsoft.disco.gco.ngc.FacturaManager;
import com.jjsoft.disco.gco.ngc.IngresoManager;
import com.jjsoft.disco.gco.util.configuraciones;
import java.util.Date;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

/**
 *
 * @author johnny
 */
public class VPrincipalAdmin extends javax.swing.JFrame {

    /**
     * Creates new form VPrincipal
     */
    Cliente cliente;
    Ingreso ingreso;
    Factura factura;

    public VPrincipalAdmin(double saldoCaja) {

        initComponents();
        cmdNuevo.setEnabled(false);
        cmdBuscar.setEnabled(false);
        cmdLimpiar.setVisible(false);
        if (configuraciones.usuario.getRol() == 2) {
            mnuBarra.setVisible(false);
            cmdRegistrarEntrada.setVisible(false);
            cmdRegistrarSalida.setVisible(false);
            cmdFacturar.setVisible(false);
            cmdBuscar.setVisible(false);
            cmdNuevo.setVisible(false);
            mnuCompras.setVisible(false);
            
        } else if (configuraciones.usuario.getRol() == 3) {
            mnuBarra.setVisible(false);
            cmdRegistrarEntrada.setVisible(true);
            cmdRegistrarSalida.setVisible(false);
            cmdFacturar.setVisible(false);
            cmdBuscar.setVisible(true);
            cmdNuevo.setVisible(true);
            mnuCompras.setVisible(false);
        }
        this.lblLocal.setText(configuraciones.NombreLocal);
        this.lblDireccion.setText("Dirección: " + configuraciones.Direccion);
        this.lblPropietario.setText("Propietario: " + configuraciones.NombrePropietario);
        this.lblTelefono.setText("Telefono:" + configuraciones.Telefono);
        this.lblUsuario.setText("Usuario: " + configuraciones.usuario.getNombre());
        ImageIcon icono = null;
        if (configuraciones.logo != null && configuraciones.logo.length() > 0) {
            configuraciones.logo = configuraciones.logo.replace('\\', '/');
            icono = new ImageIcon(configuraciones.logo);
            this.lblLogo.setIcon(icono);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem21 = new javax.swing.JMenuItem();
        jLabel1 = new javax.swing.JLabel();
        txtBuscar = new javax.swing.JTextField();
        cmdBuscar = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        txtCedula = new javax.swing.JTextField();
        txtNombres = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtApellidos = new javax.swing.JTextField();
        txtDireccion = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtTelefono = new javax.swing.JTextField();
        txtFNacimiento = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        cmdFacturar = new javax.swing.JButton();
        cmdRegistrarEntrada = new javax.swing.JButton();
        cmdNuevo = new javax.swing.JButton();
        cmdRegistrarSalida = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        lblLogo = new javax.swing.JLabel();
        lblLocal = new javax.swing.JLabel();
        lblTelefono = new javax.swing.JLabel();
        lblPropietario = new javax.swing.JLabel();
        lblDireccion = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        cmdLimpiar = new javax.swing.JButton();
        lblUsuario = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        txtHombres = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        txtMujeres = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        txtManillasMujeres = new javax.swing.JTextField();
        txtManillasHombres = new javax.swing.JTextField();
        mnuBarra = new javax.swing.JMenuBar();
        mnuMantenimientos = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        mnuManArticulos = new javax.swing.JMenuItem();
        mnuManProveedores = new javax.swing.JMenuItem();
        mnuMantenimientoCategorias = new javax.swing.JMenuItem();
        mnuMantenimientoCategoria = new javax.swing.JMenuItem();
        mnuMantenimientoUnidades = new javax.swing.JMenuItem();
        mnuCompras = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        mnuReportes = new javax.swing.JMenu();
        mnuStock = new javax.swing.JMenuItem();
        mnuCajaDiariaUsuario = new javax.swing.JMenuItem();
        mnuRepVentasFechas = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        mnuSistema = new javax.swing.JMenu();
        mnuAjustes = new javax.swing.JMenuItem();
        mnuUsuarios = new javax.swing.JMenuItem();
        mnuReindexar = new javax.swing.JMenuItem();

        jMenuItem21.setText("jMenuItem21");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de Ventas ");
        setBackground(new java.awt.Color(204, 204, 204));
        setForeground(new java.awt.Color(204, 204, 204));

        jLabel1.setText("Tarjeta:");

        txtBuscar.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        txtBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtBuscarActionPerformed(evt);
            }
        });
        txtBuscar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtBuscarKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtBuscarKeyReleased(evt);
            }
        });

        cmdBuscar.setBackground(new java.awt.Color(153, 153, 153));
        cmdBuscar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        cmdBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/buscar.png"))); // NOI18N
        cmdBuscar.setText("        Buscar");
        cmdBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdBuscarActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(51, 51, 51));
        jLabel2.setText("Cedula/Ruc:");

        txtCedula.setEditable(false);
        txtCedula.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCedulaActionPerformed(evt);
            }
        });
        txtCedula.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtCedulaKeyPressed(evt);
            }
        });

        txtNombres.setEditable(false);
        txtNombres.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNombresActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(51, 51, 51));
        jLabel3.setText("Nombres:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(51, 51, 51));
        jLabel4.setText("Apellidos:");

        txtApellidos.setEditable(false);

        txtDireccion.setEditable(false);

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(51, 51, 51));
        jLabel5.setText("Direccion:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(51, 51, 51));
        jLabel6.setText("Telefono:");

        txtTelefono.setEditable(false);

        txtFNacimiento.setEditable(false);

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(51, 51, 51));
        jLabel7.setText("F. Nacimiento:");

        cmdFacturar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        cmdFacturar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/factura2.png"))); // NOI18N
        cmdFacturar.setText("        VENDER");
        cmdFacturar.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        cmdFacturar.setEnabled(false);
        cmdFacturar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdFacturarActionPerformed(evt);
            }
        });

        cmdRegistrarEntrada.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        cmdRegistrarEntrada.setText("REGISTRAR ENTRADA");
        cmdRegistrarEntrada.setEnabled(false);
        cmdRegistrarEntrada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdRegistrarEntradaActionPerformed(evt);
            }
        });

        cmdNuevo.setBackground(new java.awt.Color(153, 153, 153));
        cmdNuevo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        cmdNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/new.png"))); // NOI18N
        cmdNuevo.setText("         Nuevo");
        cmdNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdNuevoActionPerformed(evt);
            }
        });

        cmdRegistrarSalida.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        cmdRegistrarSalida.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/mantenimiento.png"))); // NOI18N
        cmdRegistrarSalida.setText("REGISTRAR SALIDA");
        cmdRegistrarSalida.setEnabled(false);
        cmdRegistrarSalida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdRegistrarSalidaActionPerformed(evt);
            }
        });

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/83941cd31777e55452c4668be753b8b3.png"))); // NOI18N

        lblLocal.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        lblLocal.setForeground(new java.awt.Color(0, 0, 255));
        lblLocal.setText("jLabel9");

        lblTelefono.setText("jLabel9");

        lblPropietario.setText("jLabel10");

        lblDireccion.setText("jLabel11");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel11.setForeground(new java.awt.Color(51, 51, 51));
        jLabel11.setText("Email:");

        txtEmail.setEditable(false);

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(0, 51, 255));
        jLabel10.setText("Cliente");

        cmdLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdLimpiarActionPerformed(evt);
            }
        });

        lblUsuario.setText("jLabel9");

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel12.setForeground(new java.awt.Color(51, 51, 51));
        jLabel12.setText("Hombres:");

        txtHombres.setEditable(false);
        txtHombres.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtHombresKeyPressed(evt);
            }
        });

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel13.setForeground(new java.awt.Color(51, 51, 51));
        jLabel13.setText("Mujeres:");

        txtMujeres.setEditable(false);
        txtMujeres.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtMujeresKeyPressed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel14.setForeground(new java.awt.Color(51, 51, 51));
        jLabel14.setText("Manillas:");

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(51, 51, 51));
        jLabel15.setText("Manillas:");

        txtManillasMujeres.setEditable(false);
        txtManillasMujeres.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtManillasMujeresKeyPressed(evt);
            }
        });

        txtManillasHombres.setEditable(false);
        txtManillasHombres.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtManillasHombresKeyPressed(evt);
            }
        });

        mnuBarra.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mnuBarra.setForeground(new java.awt.Color(0, 0, 204));
        mnuBarra.setMargin(new java.awt.Insets(0, 0, 0, 10));
        mnuBarra.setPreferredSize(new java.awt.Dimension(95, 35));

        mnuMantenimientos.setText("Mantenimientos");
        mnuMantenimientos.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("Clientes");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        mnuMantenimientos.add(jMenuItem1);

        mnuManArticulos.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuManArticulos.setText("Articulos");
        mnuManArticulos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuManArticulosActionPerformed(evt);
            }
        });
        mnuMantenimientos.add(mnuManArticulos);

        mnuManProveedores.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuManProveedores.setText("Proveedores");
        mnuManProveedores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuManProveedoresActionPerformed(evt);
            }
        });
        mnuMantenimientos.add(mnuManProveedores);

        mnuMantenimientoCategorias.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuMantenimientoCategorias.setText("Cocteles");
        mnuMantenimientoCategorias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMantenimientoCategoriasActionPerformed(evt);
            }
        });
        mnuMantenimientos.add(mnuMantenimientoCategorias);

        mnuMantenimientoCategoria.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuMantenimientoCategoria.setText("Categorias");
        mnuMantenimientoCategoria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMantenimientoCategoriaActionPerformed(evt);
            }
        });
        mnuMantenimientos.add(mnuMantenimientoCategoria);

        mnuMantenimientoUnidades.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuMantenimientoUnidades.setText("Unidades de Medida");
        mnuMantenimientoUnidades.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMantenimientoUnidadesActionPerformed(evt);
            }
        });
        mnuMantenimientos.add(mnuMantenimientoUnidades);

        mnuBarra.add(mnuMantenimientos);

        mnuCompras.setText("Compras");

        jMenuItem3.setText("Registrar Compra");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        mnuCompras.add(jMenuItem3);

        jMenu2.setText("Buscar Compras");

        jMenuItem4.setText("Por Fecha");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem4);

        jMenuItem5.setText("Por Proveedor");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem5);

        mnuCompras.add(jMenu2);

        mnuBarra.add(mnuCompras);

        mnuReportes.setText("Reportes");

        mnuStock.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuStock.setText("Stock");
        mnuStock.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuStockActionPerformed(evt);
            }
        });
        mnuReportes.add(mnuStock);

        mnuCajaDiariaUsuario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuCajaDiariaUsuario.setText("Caja Diaria Usuario");
        mnuCajaDiariaUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuCajaDiariaUsuarioActionPerformed(evt);
            }
        });
        mnuReportes.add(mnuCajaDiariaUsuario);

        mnuRepVentasFechas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuRepVentasFechas.setText("Reporte Ventas Fecha");
        mnuRepVentasFechas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuRepVentasFechasActionPerformed(evt);
            }
        });
        mnuReportes.add(mnuRepVentasFechas);

        mnuBarra.add(mnuReportes);

        jMenu1.setText("Barras");

        jMenuItem2.setText("Ver / Agregar Producotos a las Barras");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        mnuBarra.add(jMenu1);

        mnuSistema.setText("Sistema");

        mnuAjustes.setText("Ajustes");
        mnuAjustes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuAjustesActionPerformed(evt);
            }
        });
        mnuSistema.add(mnuAjustes);

        mnuUsuarios.setText("Usuarios");
        mnuUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuUsuariosActionPerformed(evt);
            }
        });
        mnuSistema.add(mnuUsuarios);

        mnuReindexar.setText("Reindexar Datos");
        mnuReindexar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuReindexarActionPerformed(evt);
            }
        });
        mnuSistema.add(mnuReindexar);

        mnuBarra.add(mnuSistema);

        setJMenuBar(mnuBarra);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addComponent(lblLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(41, 41, 41)
                                .addComponent(lblDireccion)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblTelefono)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblPropietario))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(190, 190, 190)
                                .addComponent(lblLocal))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(240, 240, 240)
                        .addComponent(jLabel10)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jSeparator1)
                        .addGap(10, 10, 10))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 80, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addGap(573, 573, 573))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(cmdFacturar, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(cmdRegistrarEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(cmdLimpiar))
                                        .addGap(18, 18, 18)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(cmdRegistrarSalida)
                                            .addComponent(lblUsuario)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(txtBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(layout.createSequentialGroup()
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addComponent(jLabel3)
                                                    .addComponent(jLabel2)
                                                    .addComponent(jLabel4)
                                                    .addComponent(jLabel5)
                                                    .addComponent(jLabel6)
                                                    .addComponent(jLabel7)
                                                    .addComponent(jLabel11)
                                                    .addComponent(jLabel12)
                                                    .addComponent(jLabel13))
                                                .addGap(18, 18, 18)
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(txtFNacimiento, javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(txtTelefono, javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(txtDireccion, javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(txtApellidos, javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(txtNombres, javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(txtCedula, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(txtEmail, javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                            .addComponent(txtMujeres, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
                                                            .addComponent(txtHombres, javax.swing.GroupLayout.Alignment.LEADING))
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING)
                                                            .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING))
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addComponent(txtManillasHombres, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addComponent(txtManillasMujeres, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addGroup(layout.createSequentialGroup()
                                                .addGap(45, 45, 45)
                                                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(cmdBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(cmdNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                                .addGap(33, 33, 33))))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblLogo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lblLocal)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblDireccion)
                            .addComponent(lblTelefono)
                            .addComponent(lblPropietario))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel10)
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cmdNuevo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtCedula, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2)
                        .addComponent(cmdBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtNombres, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtApellidos, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtFNacimiento, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11)
                            .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtHombres, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12)
                            .addComponent(txtManillasHombres, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14)))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtMujeres, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(jLabel15)
                    .addComponent(txtManillasMujeres, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmdRegistrarEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cmdRegistrarSalida)
                    .addComponent(cmdFacturar, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cmdLimpiar)
                    .addComponent(lblUsuario))
                .addContainerGap())
        );

        setSize(new java.awt.Dimension(718, 661));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void mnuManProveedoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuManProveedoresActionPerformed
        // TODO add your handling code here:
        VMantenimientoProveedores.getInstance().show();
    }//GEN-LAST:event_mnuManProveedoresActionPerformed

    private void txtNombresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNombresActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNombresActionPerformed

    private void cmdBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdBuscarActionPerformed
        // TODO add your handling code here:
        ClienteManager clienteManager = new ClienteManager();
        cliente = clienteManager.buscarPorCedula(txtCedula.getText());
        if (cliente != null) {
            llenaTextos();
            if (ingreso == null) {
                cmdRegistrarEntrada.setEnabled(true);
                cmdRegistrarSalida.setEnabled(false);
                cmdFacturar.setEnabled(false);
            }
        } else {
            cliente = null;
            cmdRegistrarEntrada.setEnabled(false);
            limpiaTextos();
        }

    }//GEN-LAST:event_cmdBuscarActionPerformed

    private void cmdFacturarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdFacturarActionPerformed
        // TODO add your handling code here:
        txtBuscar.setText("");
        txtBuscar.requestFocus();
        new VFactura(factura, cmdLimpiar).show();

    }//GEN-LAST:event_cmdFacturarActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        VMantenimientoCliente mantCli = VMantenimientoCliente.getInstance();
        mantCli.show();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void mnuManArticulosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuManArticulosActionPerformed
        // TODO add your handling code here:
        VMantenimientoProductos.getInstance().show();

    }//GEN-LAST:event_mnuManArticulosActionPerformed

    private void cmdNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdNuevoActionPerformed
        // TODO add your handling code here:
        new VNuevoCliente(txtCedula.getText(), cmdBuscar).show();
    }//GEN-LAST:event_cmdNuevoActionPerformed

    private void cmdRegistrarEntradaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdRegistrarEntradaActionPerformed
        // TODO add your handling code here:
        if (cliente != null) {
            Date d = new Date();
            int numPersH = 0;
            int numPersM = 0;
            int numManillasHombres = 0;
            int numManillasMujeres = 0;
            try {
                numPersH = Integer.parseInt(txtHombres.getText());
                numPersM = Integer.parseInt(txtMujeres.getText());
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(rootPane, "Ingrese un numero correcto de ingresos de hombres y mujeres");
                return;
            }
            try {
                numManillasHombres = Integer.parseInt(txtManillasHombres.getText());

            } catch (Exception ex) {
            }
            try {
                numManillasMujeres = Integer.parseInt(txtManillasMujeres.getText());

            } catch (Exception ex) {
            }
            ingreso = new Ingreso();
            if (numManillasHombres > numPersH || numManillasMujeres > numPersM) {
                JOptionPane.showMessageDialog(rootPane, "El numero de manillas no puede ser mayor al numero de personas asistentes");
                return;
            }
            ingreso.setNumeroPersonasH(numPersH);
            ingreso.setNumeroPersonasM(numPersM);
            ingreso.setNumeroManillasH(numManillasHombres);
            ingreso.setNumeroManillasM(numManillasMujeres);
            ingreso.setCedula(cliente);
            ingreso.setCodigo(txtBuscar.getText());
            ingreso.setEstado(0);
            ingreso.setHoraEntrada(d);

            cmdRegistrarEntrada.setEnabled(false);
            txtBuscar.setEditable(true);
            txtCedula.setEditable(false);
            cmdBuscar.setEnabled(false);
            factura = new Factura();
            factura.setCedulaCliente(cliente);
            //factura.setNumeroIngreso(ingreso.getIdingreso());
            factura.setFecha(d);
            factura.setEstado(0);
            factura.setCodigo(txtBuscar.getText());
            factura.setTotal(0d);
            FacturaManager facturaManager = new FacturaManager();
            facturaManager.crearFactura(factura);
            ingreso.setFactura(factura);
            IngresoManager ingresoManager = new IngresoManager();
            ingresoManager.registrarIngreso(ingreso);

            JOptionPane.showMessageDialog(rootPane, "Ingreso registrado correctamente");
            limpiaTodo();
        } else {
            JOptionPane.showMessageDialog(rootPane, "Seleccione o registre un cliente");
        }

    }//GEN-LAST:event_cmdRegistrarEntradaActionPerformed

    private void txtBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtBuscarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtBuscarActionPerformed

    private void txtBuscarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscarKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == 10) {
            ingreso = null;
            cliente = null;
            buscarTarjeta();

        } else if (evt.getKeyCode() == 27) {
            limpiaTodo();
        }
    }//GEN-LAST:event_txtBuscarKeyPressed

    private void cmdRegistrarSalidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdRegistrarSalidaActionPerformed
        // TODO add your handling code here:
        if (JOptionPane.showConfirmDialog(rootPane, "Esta seguro de Registrar la salida del cliente?", "Registrar Salida", JOptionPane.YES_NO_CANCEL_OPTION) == JOptionPane.YES_OPTION) {
            Date d = new Date();
            ingreso.setPagado(factura.getTotal());
            JOptionPane.showMessageDialog(rootPane, "Total a Pagar: " + factura.getTotal());
            new IngresoManager().registrarSalida(ingreso);
            new FacturaManager().registrarSalida(factura);
            limpiaTextos();
            txtCedula.setText("");
            cmdFacturar.setEnabled(false);
            cmdRegistrarEntrada.setEnabled(false);
            cmdRegistrarSalida.setEnabled(false);
            txtBuscar.setText("");
            txtBuscar.requestFocus();
        }
    }//GEN-LAST:event_cmdRegistrarSalidaActionPerformed

    private void mnuStockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuStockActionPerformed
        // TODO add your handling code here:
        new VReporteStock().show();
    }//GEN-LAST:event_mnuStockActionPerformed

    private void mnuAjustesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAjustesActionPerformed
        // TODO add your handling code here:
        VConfiguracionSis.getInstance().show();
    }//GEN-LAST:event_mnuAjustesActionPerformed

    private void mnuUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuUsuariosActionPerformed
        // TODO add your handling code here:
        new VUsuarios().show();
    }//GEN-LAST:event_mnuUsuariosActionPerformed

    private void mnuReindexarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuReindexarActionPerformed
        // TODO add your handling code here:
        new GenericController().indexarPrimeraVez();
        JOptionPane.showMessageDialog(rootPane, "Compeltado");
    }//GEN-LAST:event_mnuReindexarActionPerformed

    private void mnuCajaDiariaUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCajaDiariaUsuarioActionPerformed
        // TODO add your handling code here:
        new VVerCajaDiariaUsuario().show();
    }//GEN-LAST:event_mnuCajaDiariaUsuarioActionPerformed

    private void mnuRepVentasFechasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuRepVentasFechasActionPerformed
        // TODO add your handling code here:
        new VBuscarVentasFecha().show();
    }//GEN-LAST:event_mnuRepVentasFechasActionPerformed

    private void txtBuscarKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscarKeyReleased
        // TODO add your handling code here:
        //new Validacion().numeros(evt, txtBuscar);
    }//GEN-LAST:event_txtBuscarKeyReleased

    private void txtCedulaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCedulaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCedulaActionPerformed

    private void txtCedulaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCedulaKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == 10) {
            cmdBuscar.doClick();
        } else if (evt.getKeyCode() == 27) {
            limpiaTodo();
        }
    }//GEN-LAST:event_txtCedulaKeyPressed

    private void cmdLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLimpiarActionPerformed
        // TODO add your handling code here:
        limpiaTodo();
    }//GEN-LAST:event_cmdLimpiarActionPerformed

    private void mnuMantenimientoCategoriasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMantenimientoCoctelesActionPerformed
        // TODO add your handling code here:
        VMantenimientoCocteles.getInstance().show();
    }//GEN-LAST:event_mnuMantenimientoCoctelesActionPerformed

    private void mnuMantenimientoCoctelesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMantenimientoCategoriasActionPerformed
        // TODO add your handling code here:
        VMantenimientoCocteles.getInstance().show();
    }//GEN-LAST:event_mnuMantenimientoCategoriasActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        String num = JOptionPane.showInputDialog("Ingrese el número de la barra");
        if (num != null) {
            int barra = 0;

            try {
                barra = Integer.parseInt(num);
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(rootPane, "Asegurese de deigresar un número");

            }
            if (barra > 0 && barra <= configuraciones.barras) {
                new VAgregarProductoBarra(barra).show();
            } else {
                JOptionPane.showMessageDialog(rootPane, "Número de barra incorrecto");
            }
        }


    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void mnuMantenimientoCategoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMantenimientoCategoriaActionPerformed
        // TODO add your handling code here:
        VMantenimientoCategorias.getInstance().show();
    }//GEN-LAST:event_mnuMantenimientoCategoriaActionPerformed

    private void mnuMantenimientoUnidadesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMantenimientoUnidadesActionPerformed
        VMantenimientoUnidades.getInstance().show();
        // TODO add your handling code here:
    }//GEN-LAST:event_mnuMantenimientoUnidadesActionPerformed

    private void txtHombresKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtHombresKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == 27) {
            limpiaTodo();
        }
    }//GEN-LAST:event_txtHombresKeyPressed

    private void txtMujeresKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMujeresKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == 27) {
            limpiaTodo();
        }
    }//GEN-LAST:event_txtMujeresKeyPressed

    private void txtManillasMujeresKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtManillasMujeresKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtManillasMujeresKeyPressed

    private void txtManillasHombresKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtManillasHombresKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtManillasHombresKeyPressed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        // TODO add your handling code here:
        new VFacturaCompra().show();
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        // TODO add your handling code here:
        new VBuscarComprasProveedor().show();
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        // TODO add your handling code here:
        new VBuscarComprasFechas().show();
    }//GEN-LAST:event_jMenuItem4ActionPerformed
    private void llenaTextos() {
        txtCedula.setText(cliente.getCedula());
        txtNombres.setText(cliente.getNombres());
        txtApellidos.setText(cliente.getApellidos());
        txtDireccion.setText(cliente.getDireccion());
        txtTelefono.setText(cliente.getTelefono());
        txtEmail.setText(cliente.getEmail());
        try{
            txtFNacimiento.setText(cliente.getFechaNacimiento().toLocaleString());
        }catch(Exception ex)
        {
            txtFNacimiento.setText("");
        }
        
    }

    private void limpiaTodo() {
        txtCedula.setText("");
        txtBuscar.setText("");
        limpiaTextos();
        ingreso = null;
        cliente = null;
        factura = null;
        txtHombres.setEditable(false);
        txtMujeres.setEditable(false);
        txtManillasHombres.setEditable(false);
        txtManillasMujeres.setEditable(false);
    }

    private void limpiaTextos() {
        //txtCedula.setText("");
        txtNombres.setText("");
        txtApellidos.setText("");
        txtDireccion.setText("");
        txtTelefono.setText("");
        txtEmail.setText("");
        txtFNacimiento.setText("");
        txtHombres.setText("");
        txtMujeres.setText("");
        txtManillasHombres.setText("");
        txtManillasMujeres.setText("");
    }

    private void habilitaControles(boolean estado) {
    }

    private void cambiaDesplazamientos(boolean estado) {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(VPrincipalAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VPrincipalAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VPrincipalAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VPrincipalAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            System.out.println("Error setting native LAF: " + e);
        }
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VPrincipalAdmin(0).setVisible(true);
            }
        });
    }

    private void buscarTarjeta() {
        IngresoManager ingresoManager = new IngresoManager();
        ingreso = ingresoManager.buscarCodigoIngreso(txtBuscar.getText());
        if (ingreso != null) {
            cliente = ingreso.getCedula();
            llenaTextos();
            cmdFacturar.setEnabled(true);
            cmdRegistrarSalida.setEnabled(true);
            factura = ingreso.getFactura();
            if (configuraciones.usuario.getRol() == 2) {
                cmdFacturar.doClick();
            }
        } else if (configuraciones.usuario.getRol() != 2) {
            limpiaTextos();
            txtCedula.setText("");
            txtCedula.requestFocus();
            txtCedula.setEditable(true);
            cmdNuevo.setEnabled(true);
            cmdBuscar.setEnabled(true);
            txtBuscar.setEditable(false);
            txtHombres.setEditable(true);
            txtMujeres.setEditable(true);
            txtManillasHombres.setEditable(true);
            txtManillasMujeres.setEditable(true);
        } else {
            JOptionPane.showMessageDialog(rootPane, "Tarjeta no registrada");
            limpiaTodo();
            txtBuscar.requestFocus();
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cmdBuscar;
    private javax.swing.JButton cmdFacturar;
    private javax.swing.JButton cmdLimpiar;
    private javax.swing.JButton cmdNuevo;
    private javax.swing.JButton cmdRegistrarEntrada;
    private javax.swing.JButton cmdRegistrarSalida;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel lblDireccion;
    private javax.swing.JLabel lblLocal;
    private javax.swing.JLabel lblLogo;
    private javax.swing.JLabel lblPropietario;
    private javax.swing.JLabel lblTelefono;
    private javax.swing.JLabel lblUsuario;
    private javax.swing.JMenuItem mnuAjustes;
    private javax.swing.JMenuBar mnuBarra;
    private javax.swing.JMenuItem mnuCajaDiariaUsuario;
    private javax.swing.JMenu mnuCompras;
    private javax.swing.JMenuItem mnuManArticulos;
    private javax.swing.JMenuItem mnuManProveedores;
    private javax.swing.JMenuItem mnuMantenimientoCategoria;
    private javax.swing.JMenuItem mnuMantenimientoCategorias;
    private javax.swing.JMenuItem mnuMantenimientoUnidades;
    private javax.swing.JMenu mnuMantenimientos;
    private javax.swing.JMenuItem mnuReindexar;
    private javax.swing.JMenuItem mnuRepVentasFechas;
    private javax.swing.JMenu mnuReportes;
    private javax.swing.JMenu mnuSistema;
    private javax.swing.JMenuItem mnuStock;
    private javax.swing.JMenuItem mnuUsuarios;
    private javax.swing.JTextField txtApellidos;
    private javax.swing.JTextField txtBuscar;
    private javax.swing.JTextField txtCedula;
    private javax.swing.JTextField txtDireccion;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtFNacimiento;
    private javax.swing.JTextField txtHombres;
    private javax.swing.JTextField txtManillasHombres;
    private javax.swing.JTextField txtManillasMujeres;
    private javax.swing.JTextField txtMujeres;
    private javax.swing.JTextField txtNombres;
    private javax.swing.JTextField txtTelefono;
    // End of variables declaration//GEN-END:variables
}
